import { menuList } from '../system/menu/data'
import { noticeList } from './data/notice'
import Mock from 'mockjs'
const { Random } = Mock

export default [
  // 获取用户信息
  {
    url: '/system/auth/get-user-info',
    method: 'get',
    response: () => {
      const permitList: any = []
      menuList.forEach((item: any) => {
        if (item.type === 2 || item.type === 3) {
          permitList.push(item.permit)
        }
      })
      return {
        code: 200,
        status: true,
        msg: '成功',
        data: {
          user: {
            id: 1,
            username: 'admin',
            password: '123456',
            nickname: '超级管理员',
            avatar: 'https://img1.baidu.com/it/u=1919046953,770482211&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
            departName: '总公司',
            departId: 1,
            tenantType: 1,
            roleIds: '1',
            postIds: '',
            mobile: /1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}/,
            email: Random.email(),
            status: 0,
            sex: Random.integer(1, 2),
            remark: '@csentence()'
          },
          permit: permitList,
          menus: menuList.filter(item => item.type !== 3)
        }
      }
    }
  },
  {
    url: '/system/auth/get-notice-info',
    method: 'get',
    response: () => {
      return {
        code: 200,
        status: true,
        info: '成功',
        data: noticeList
      }
    }
  }
]
